package com.canplay.screen.network

import okhttp3.Interceptor
import okhttp3.Response

class MaxRequestSizeInterceptor(private val maxRequestSize: Long): Interceptor {

    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()
        if (request.body != null && request.body!!.contentLength() > maxRequestSize) {
            throw IllegalArgumentException("Request body size exceeds maximum allowed size")
        }
        return chain.proceed(request)
    }
}